# -*- coding:utf-8 -*-
# @Author: shenyuyu
# @Time: 2023/6/28 17:42
# @File: qu_5_spark_sql_api_json_dataframe.py
from pyspark.sql import SparkSession
from pyspark.sql.types import StructType, StringType, IntegerType

if __name__ == '__main__':
    spark = SparkSession.builder.appName("a").master("local[*]").getOrCreate()
    schema = StructType().add("age", IntegerType(), True).add("name", StringType(), True)
    df = spark.read.format("json").load("file:///tmp/pycharm_project_161/data/sql/people.json")
    df.show()